/*
 *  semaMutex.c
 *  ProducerConsumer
 *
 * Operating Systems Concepts Essentials
 *	Code Sample for Mutex and Semaphore	p.269
 *
 *  Created by digi on 10/24/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 *
 *	EECE 315
 *	Project #2
 *	
 *	Procucer-Consumer Problem
 *	
 *	Authors:
 *			Mohamed Ali
 *			Donald Cheng
 *			Krzysztof Mazurek
 *			Ishan Sahay
 *	
 *	Date: 24 / Oct / 2012
 *	
 */


/***********************
 Mutex
***********************/

#include <pthread.h> 

pthread_mutex_t_mutex;

/* create the mutex lock */ 
pthread_mutex_init(&mutex,NULL);

/* acquire the mutex lock */ 
pthread_mutex_lock(&mutex);

/*** critical section ***/

/* release the mutex lock */ 
pthread_mutex_unlock(&mutex);


/***********************
 Semaphore
 ***********************/

#include <semaphore.h>

sem_t sem;

/* Create the semaphore and initialize it to 5 */ 
sem_init(&sem, 0, 5);



